#include <bits/stdc++.h>
using namespace std;
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
using ll = long long;
const ll N = 3e5 + 10;
ll a[N],p[N];
ll pfind(ll x)
{
    if(p[x]!=x)
    {
        p[x] = pfind(p[x]);
    }
    return p[x];
}
void solve()
{
    ll n;
    cin >> n;
    for (ll i = 1; i <= n;i++)
    {
        cin >> a[i];
        p[i] = i;
    }

    for (ll i = 1;i<=n;i++)
    {
        if(i-a[i]>=1)
        {
            p[pfind(i - a[i])] = pfind(i);
        }
        if (i + a[i] <= n)
        {
            p[pfind(i+ a[i])] = pfind(i);
        }
    }

    ll ans = 0;
    for (ll i = 2; i <= n;i++)
    {
        if(pfind(i)!=pfind(i-1))
        {
            ans++;
            p[pfind(i)] = pfind(i - 1);
        }
    }

    cout << ans << endl;
}
int main()
{
    int t = 1;
    cin >> t;
    while(t--)
    {
        solve();
    }
   return 0;
}
